package dk.mirasola.systemtraining.user.client.ui.createbiddingsetwizard;

import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.ui.Button;
import dk.mirasola.systemtraining.user.client.i18n.CreateBiddingSetWizardTexts;
import dk.mirasola.systemtraining.user.client.ui.wizard.Wizard;
import dk.mirasola.systemtraining.user.shared.transfer.CreateBiddingSetTO;

public class CreateBiddingSetWizard extends Wizard {
    final CreateBiddingSetWizardTexts texts = GWT.create(CreateBiddingSetWizardTexts.class);

    private CreateBiddingSetTO createBiddingSetTO;

    public CreateBiddingSetWizard() {
        createBiddingSetTO = new CreateBiddingSetTO();
        createBiddingSetTO.setSouthLocale(getCurrentLocale());
        createBiddingSetTO.setNorthLocale(getCurrentLocale());

        getBack().setHTML(texts.backButton());
        getNext().setHTML(texts.nextButton());
        getFinish().setHTML(texts.finishButton());
        getCancel().setHTML(texts.cancelButton());

        addWizardStep(new DistributionFilterStep(createBiddingSetTO, texts, getNext()));
        addWizardStep(new DetailsStep(createBiddingSetTO, texts, getNext(), getBack(), getFinish()));
        addWizardStep(new GenerateBoardsStep(createBiddingSetTO, texts, getBack(), getFinish(),getCancel()));
    }

    private String getCurrentLocale() {
        String localeName = LocaleInfo.getCurrentLocale().getLocaleName();
        if ("default".equals(localeName)) {
            return "en";
        }
        return localeName;
    }

    @Override
    public Button getCancel() {
        return super.getCancel();
    }

    @Override
    public Button getFinish() {
        return super.getFinish();
    }

    public CreateBiddingSetTO getCreateBiddingSetTO() {
        return createBiddingSetTO;
    }
}



